﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Angle.Krill.LocalesParser
{
    internal class LocalesParser
    {

        private string localesPath = string.Empty;

        public LocalesParser(string localesPath = "")
        {
            this.localesPath = string.IsNullOrEmpty(localesPath) ? Path.Combine(Application.StartupPath, "Locales/zh-CN.json") : localesPath;
        }

        public MainWindowOptions Parser()
        {
            string fileContent = File.ReadAllText(this.localesPath);

            MainWindowOptions options = JsonConvert.DeserializeObject<MainWindowOptions>(fileContent);

            return options;
        }
    }
}
